﻿using Bids.Core.DomainObjects;
using Bids.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;

using Bids.Core.Common.Pager;
namespace Bids.Web.Controllers
{
    public class TaskController : Controller
    {
        IRepository<Task> _iRpoTask;
        public TaskController( IRepository<Task> iRpoTask)
        {
            _iRpoTask = iRpoTask;
        }

        public ActionResult List(int? page)
        {
            var pagelist = _iRpoTask.Where(t => t.Status > (int)TaskStatus.未付款).OrderByDescending(t => t.CreateTime).ToPagedList(page ?? 1, 20);
            return View(pagelist);
        }
        public ActionResult Detail(int id,int? page)
        {
            TempData["page"] = 1;
            var task = _iRpoTask.Find(id);
            if (page.HasValue)
            {
                TempData["page"] = page;
                return PartialView("_WorksList", task);
            }
            return View(task);
        }
    }
}
